"""office URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""

from django.urls import path
from .views import *
from rest_framework.routers import DefaultRouter

router = DefaultRouter()
# 角色的路由
router.register('roles', RoleModelAPIView),

# 员工侧边栏展示菜单
router.register('staff_menus', StaffMenuSet),

# 获取所有菜单信息
router.register("menus", MenuSet)

# 部门路由接口
router.register('departments', DepartmentView)

# 职级接口
router.register('ranks', RankSet)

# 职位接口
router.register('positions', PositionSet)

# 日志信息接口
router.register('logmanages', LogManage)

# 材料接口
router.register("materials", MaterialsSet)


# 工资条路由接口
router.register("payrolls", PayrollSet)

urlpatterns = [
    # 搜索角色数据
    path("inqrole/", SearchRoleAPIView.as_view()),

    # 主页数据
    path("index/", StaffCountView.as_view()),

    # 角色操作
    path("role/<int:pk>", DropRole.as_view({"put":"update","delete":"delete"})),

    # 菜单操作
    path("menu/<int:pk>", DropMenu.as_view({"put":"update","delete":"delete"})),

    # 搜索菜单
    path("searmenu/", SearchMenu.as_view()),

    # 部门操作
    path("department/<int:pk>", DropDepartment.as_view({"put":"update","delete":"delete"})),

    # 搜索部门
    path("seardepar/", SearchDepartment.as_view()),

    # 职级操作
    path("rank/<int:pk>", DropRank.as_view({"put":"update","delete":"delete"})),

    # 职位操作
    path("position/<int:pk>", DropPosition.as_view({"put":"update","delete":"delete"})),

    # 修改工资条
    path("payroll/<int:pk>", PayrollView.as_view()),

    # 删除工资条
    path("payrol/<int:pk>", DropPayroll.as_view()),

    # 删除材料
    path("material/<int:pk>", MaterialsAPIView.as_view()),
]

urlpatterns += router.urls